<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新闻</title>
    <style>

        .nav-box {

        }
        .nav-box ul {
            list-style-type: none;
            display: flex;
        }
        .nav-box ul li {
            margin-left: 30px;
            padding: 10px;
            cursor: pointer;
        }
        .nav-box ul li a {
            color: black;
            font-weight: bold;
            text-decoration: none;
        }
        .article-list-box {
            margin-left: 50px;
        }
        .article-list-item {
            display: flex;
            height: 120px;
            margin: 30px 0;
        }
        .article-image {
            width: 200px;
            height: 120px;
        }
        .article-info {
            padding: 10px;
            width: 40%;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .article-title {
            font-weight: bold;
            font-size: 18px;
        }
        .article-desc {
            margin-top: 10px;
            font-size: 14px;
            color: gray;
            height: 40px;
            overflow: hidden;
        }
        .badge {
            position: absolute;
            font-size: 12px;
            color: #FFFFFF;
            background-color: red;
            padding: 5px;
        }
        .num-and-cate {
            font-size: 14px;
            margin-top: 5px;
            color: gray;
        }
        .nav-active {
            border-bottom: 4px solid red;
        }

    </style>
</head>
<body>
    <div class="nav-box">
        <ul>
            <li <if $Request.param.category_id == '' >class="nav-active"</if>>
                <a href="{:url('Article/index')}">全部</a>
            </li>
            <foreach name="category" item="v">
                <li <if $Request.param.category_id == $v.category_id >class="nav-active"</if>>
                <a href="{:url('Article/index')}?category_id={$v.category_id}">{$v.category_name}</a>
            </li>
            </foreach>
        </ul>

    </div>

    <div class="article-list-box" >
        <foreach name="data" item="vo">
            <if $vo.status == 1>
            <div class="article-list-item">
                <if $vo.is_recom == 1>
                    <div class="badge">推荐</div>
                </if>
                <div>
                    <img src="/upload/{$vo.image}" class="article-image">
                </div>
                <div class="article-info">
                    <div class="article-title">
                        <a style="text-decoration-line: none" href="{:url('Article/news')}?art_id={$vo.art_id}')">
                            {$vo.title}
                        </a>
                    </div>
                    <div class="article-desc">{$vo.desc}</div>
                    <div class="num-and-cate">{$vo.read_num} 次阅读&nbsp;&nbsp;&nbsp;作者：{$vo.author}&nbsp;&nbsp;&nbsp;发布时间：{$vo.create_time}</div>
                </div>
            </div>
            </if>
        </foreach>
    </div>

</body>
</html>